<?php

class Kesiswaan extends Controller {

    function Kesiswaan() {
        parent::Controller();
    }

    function index() {
        $this->load->view('kesiswaan/kesiswaan');
    }

    function pendaftaran_form() {
        $this->load->view('kesiswaan/pendaftaran_form');
    }

    function calon_siswa_create() {
        $this->load->model('Calon_siswa');
        $result = $this->Calon_siswa->create();

        if($result) {
            $this->load->view('kesiswaan/pendaftaran_berhasil');
        }
    }

    function calon_siswa_list() {
        $this->load->model('Calon_siswa');
        $data['calon_siswa_list'] = $this->Calon_siswa->read_daftar();

        $this->load->view('kesiswaan/calon_siswa_list',$data);
    }

    function calon_siswa_profile($id) {
        $this->load->model('Calon_siswa');
        $data['siswa'] = $this->Calon_siswa->read_by_id($id);

        $this->load->view('kesiswaan/calon_siswa_profile',$data);
    }

    function calon_siswa_delete($id) {
        $this->load->model('Calon_siswa');
        $result = $this->Calon_siswa->delete($id);

        if($result) {
            $this->calon_siswa_list();
        }
    }

    function calon_siswa_update() {
        $this->load->model('Calon_siswa');
        $result = $this->Calon_siswa->update();

        if($result) {
            $this->calon_siswa_profile($result);
        }
    }

    function calon_siswa_filter() {
        $this->load->model('Calon_siswa');
        $data['calon_siswa_filter'] = $this->Calon_siswa->read_filter();

        $this->load->view('kesiswaan/calon_siswa_filter',$data);
    }

    function calon_siswa_update_filter($id) {
        $this->load->model('Calon_siswa');
        $result = $this->Calon_siswa->update_filter($id);

        if($result) {
            $this->calon_siswa_list();
        }
    }

    function calon_siswa_update_unfilter($id) {
        $this->load->model('Calon_siswa');
        $result = $this->Calon_siswa->update_unfilter($id);

        if($result) {
            $this->calon_siswa_filter();
        }
    }


    /* Controller Siswa di kesiswaan.php */

        function siswa_list() {
        $this->load->model('Siswa');
        $data['siswa_list'] = $this->Siswa->read_all();

        $this->load->view('kesiswaan/siswa_list',$data);
    }

    function siswa_profile($id) {
        $this->load->model('Siswa');
        $data['siswa'] = $this->Siswa->read_by_id($id);

        $this->load->view('kesiswaan/siswa_profile',$data);
    }

    function siswa_delete($id) {
        $this->load->model('Siswa');
        $result = $this->Siswa->delete($id);

        if($result) {
            $this->siswa_list();
        }
    }

    function siswa_update() {
        $this->load->model('Siswa');
        $result = $this->Siswa->update();

        if($result) {
            $this->siswa_profile($result);
        }
    }


}

/* End of file kesiswaan.php */
/* Location: ./system/application/controllers/kesiswaan.php */